$(document).ready(function() {	
	$('#main-nav').find('ul > li > a:first').css('background-color', '#39c');
	
	$('#main-nav').find('ul > li > a').click(function(ev) {
		var bgVal = $(this).css('background-color');
		if(bgVal == '#000' || bgVal == 'rgb(0, 0, 0)') {
			$('#main-nav').find('ul > li > a').css('background-color', '#000');
			$(this).css('background-color', '#39c');
			// return to the page.
			var pageId = $(this).attr('id');
			//Can not use this way, there are a security problem in IE9
			//$('#iframe_show_box').contents().get(0).location = "products/product_" + pageId + ".html";
			if(pageId != null && pageId != '') {
				$('#iframe_show_box').get(0).contentWindow.location = "products/product_" + pageId + ".html";
			}
		}
	});
	
	$('#header_nav li').hover(
        function () {
            //show its submenu
            $('ul', this).slideDown(200);
 
        },
        function () {
            //hide its submenu
            $('ul', this).slideUp(200);        
        }
    );
});

function getMoreProducts(id) {
	if(id) {
		window.location = "../products/all_products_" + id + ".html";
	}
}